package cn.maiyar.common.constant;

/**
 * Security 相关常量
 *
 * @author c.c
 */
public class SecurityConstants {
    // token请求头名称
    public final static String TOKEN_HEADER = "Authorization";
    // token请求头类型
    public final static String BASIC_TYPE = "Basic";
    // token请求头名称
    public final static String ACCESS_TOKEN = "access_token";
    // token类型
    public final static String BEARER_TYPE = "Bearer";
    // 用户信息分隔符
    public final static String USER_SPLIT = ":";

    // 授权码模式
    public final static String AUTHORIZATION_CODE = "authorization_code";
    // 密码模式
    public final static String PASSWORD = "password";

    // 刷新token
    public final static String REFRESH_TOKEN = "refresh_token";
    // 获取 Token URL
    public final static String OAUTH_TOKEN_URL = "/oauth/token";

    // 默认的处理验证码的url前缀
    public final static String DEFAULT_VALIDATE_CODE_URL_PREFIX = "/validata/code";
    // 默认保存code的前缀
    public final static String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY";
    // 公共前缀
    public final static String GM_PREFIX = "mr:";

    //  缓存client的redis key，这里是hash结构存储
    public final static String CACHE_CLIENT_KEY = "oauth_client_details";
    // OAUTH模式登录处理地址
    public final static String OAUTH_LOGIN_PRO_URL = "/user/login";
    // PASSWORD模式登录处理地址
    public final static String PASSWORD_LOGIN_PRO_URL = "/oauth/user/token";
    // 获取授权码地址
    public final static String AUTH_CODE_URL = "/oauth/authorize";
    // 登录页面
    public final static String LOGIN_PAGE = "/login.html";
    // 登出URL
    public final static String LOGOUT_URL = "/oauth/remove/token";
    // 默认token过期时间(七天)
    public final static Integer ACCESS_TOKEN_VALIDITY_SECONDS = 60 * 60 * 24 * 7;
    // redis中授权token对应的key
    public final static String REDIS_TOKEN_AUTH = "oauth2:";
    // redis中应用对应的token集合的key
    public final static String REDIS_CLIENT_ID_TO_ACCESS = "client_id_to_access:";
    // redis中用户名对应的token集合的key
    public final static String REDIS_UNAME_TO_ACCESS = "uname_to_access:";
    // rsa公钥
    public final static String RSA_PUBLIC_KEY = "pubkey.txt";
}
